<template>
  <div>
    <app-header :user="user" ></app-header>
    <router-view></router-view>
    <app-footer></app-footer>
  </div>
</template>

<script>



import AppFooter from './Footer.vue'
import AppHeader from './Header.vue'

  export default {
    data () {
      return {
        massage: 'hello Vue',
        user: null
      }
    },
    components: {
      AppHeader,
      AppFooter
    },
    async beforeRouteEnter (to, from, next) {
      try {
        const {data: session} = await axios.get('/api/session')
        next(vm => {
          vm.user = session
        })
      } catch(e) {
        next(vm => {
        })
      }

    },
    methods: {

    }
  }
</script>


<style>
  
</style>